Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Oct 15, 2025

The file traversal logic in the list_projects MCP tool did not previously handle symbolic link loops. In a repository with a symlink pointing to a parent directory, this could cause the tool to enter an infinite loop, consuming CPU and memory until it crashed or was terminated.

This commit enhances the findAngularJsonFiles function to make it resilient to such loops. It now uses fs.stat to retrieve the inode of each directory and tracks visited inodes in a Set. If a directory with a previously seen inode is encountered, it is skipped, effectively breaking the infinite loop.

This change adds a minor performance overhead due to the extra stat call per directory, but this is a trade-off for the increase in robustness and stability when operating on complex or untrusted file systems.

…loops

The file traversal logic in the `list_projects` MCP tool did not previously handle symbolic link loops. In a repository with a symlink pointing to a parent directory, this could cause the tool to enter an infinite loop, consuming CPU and memory until it crashed or was terminated.

This commit enhances the `findAngularJsonFiles` function to make it resilient to such loops. It now uses `fs.stat` to retrieve the inode of each directory and tracks visited inodes in a Set. If a directory with a previously seen inode is encountered, it is skipped, effectively breaking the infinite loop.

This change adds a minor performance overhead due to the extra `stat` call per directory, but this is a trade-off for the increase in robustness and stability when operating on complex or untrusted file systems.
@clydin clydin added the target: major This PR is targeted for the next major release label Oct 15, 2025
@clydin clydin added the action: merge The PR is ready for merge by the caretaker label Oct 16, 2025
@clydin clydin merged commit 53180a8 into angular:main Oct 16, 2025
34 checks passed
@clydin clydin deleted the mcp/list_projects-inodes branch October 16, 2025 01:50
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants